package com.deshan.websys.code.service.impl;

import com.deshan.websys.code.mapper.PmsImMapper;
import com.deshan.websys.code.mapper.PmsNoticeMapper;
import com.deshan.websys.code.model.PmsIm;
import com.deshan.websys.code.model.PmsNotice;
import com.deshan.websys.code.service.PmsImService;
import com.deshan.websys.code.service.PmsNoticeService;
import com.deshan.websys.code.utils.StringUtils;
import com.deshan.websys.code.utils.UuidUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Calendar;
import java.util.List;

@Service

public class PmsNoticeServiceImpl implements PmsNoticeService {
    @Resource
    PmsNoticeMapper pmsNoticeMapper;

    @Override
    public List<PmsNotice> getNoticeDatas() {
        List<PmsNotice>  resultList= pmsNoticeMapper.selectList(null);
        return resultList;
    }

    @Override
    public int saveNoticeData(PmsNotice pmsNotice) {
        String id =pmsNotice.getId();
        if(StringUtils.isEmpty(id)){
            pmsNotice.setId(UuidUtils.shortUuid());
        }
        pmsNotice.setCreatetime(Calendar.getInstance().getTime());
        int  result= pmsNoticeMapper.insert(pmsNotice);
        return result;
    }
}
